package ATM;

public class BalanceInquiry extends Transaction implements ExecuteTransaction //inherits from Transaction superclass 
{																			// implements ExecuteTransaction interface to execute the Factory pattern

	public BalanceInquiry(int userAccountNumber, Screen atmScreen, BankDatabase atmBankDatabase)
	{
		super(userAccountNumber, atmScreen, atmBankDatabase);
	}
	
	@Override
	public void execute() // overrides execute() from the ExecuteTransaction interface
	{
		BankDatabase bankDatabase = getBankDatabase();
		Screen screen = getScreen();
		
		double availableBalance = bankDatabase.getAvailableBalance(getAccountNumber());
		
		screen.displayMessageLine("\nBalance Information: ");
		screen.displayMessage(" - Available balance: ");
		screen.displayDollarAmount(availableBalance);
	}	
}